Repository navigation
fix: Prevent the C API from swapping track data and metric values - #639
Merged
Merged
Conversation
Generated-by: termag
kinyoklion
marked this pull request as ready for review
November 4, 2026 22:09
beekld
approved these changes
Nov 4, 2026
Merged
kinyoklion
pushed a commit
that referenced
this pull request
Nov 9, 2026
🤖 I have created a release *beep* *boop* --- <details><summary>launchdarkly-cpp-client: 3.13.0</summary> ## [3.13.0](launchdarkly-cpp-client-v3.12.0...launchdarkly-cpp-client-v3.13.0) (2026-11-04) ### Features * Add the FDv2 cache initializer and per-context freshness to the client ([#613](#613)) ([a33e3f0](a33e3f0)) * Add the FDv2 data source orchestrator to the client SDK ([#612](#612)) ([7633334](7633334)) ### Bug Fixes * Prevent the C API from swapping track data and metric values ([#639](#639)) ([b363019](b363019)) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/cpp-internal bumped from 0.15.0 to 0.16.0 </details> <details><summary>launchdarkly-cpp-internal: 0.16.0</summary> ## [0.16.0](launchdarkly-cpp-internal-v0.15.0...launchdarkly-cpp-internal-v0.16.0) (2026-11-04) ### Features * Add the FDv2 data source orchestrator to the client SDK ([#612](#612)) ([7633334](7633334)) </details> <details><summary>launchdarkly-cpp-server: 3.15.0</summary> ## [3.15.0](launchdarkly-cpp-server-v3.14.0...launchdarkly-cpp-server-v3.15.0) (2026-11-04) ### Features * Add the FDv2 data source orchestrator to the client SDK ([#612](#612)) ([7633334](7633334)) ### Bug Fixes * Prevent the C API from swapping track data and metric values ([#639](#639)) ([b363019](b363019)) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/cpp-internal bumped from 0.15.0 to 0.16.0 </details> <details><summary>launchdarkly-cpp-server-dynamodb-source: 0.3.3</summary> ## [0.3.3](launchdarkly-cpp-server-dynamodb-source-v0.3.2...launchdarkly-cpp-server-dynamodb-source-v0.3.3) (2026-11-04) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/cpp-server bumped from 3.14.0 to 3.15.0 </details> <details><summary>launchdarkly-cpp-server-otel: 0.1.7</summary> ## [0.1.7](launchdarkly-cpp-server-otel-v0.1.6...launchdarkly-cpp-server-otel-v0.1.7) (2026-11-04) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/cpp-server bumped from 3.14.0 to 3.15.0 </details> <details><summary>launchdarkly-cpp-server-redis-source: 2.4.3</summary> ## [2.4.3](launchdarkly-cpp-server-redis-source-v2.4.2...launchdarkly-cpp-server-redis-source-v2.4.3) (2026-11-04) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/cpp-server bumped from 3.14.0 to 3.15.0 </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > Release Please cut that **bumps published versions** across the monorepo (manifest, `CMakeLists.txt`, `package.json`, embedded `Version()` strings, and matching test expectations) and **adds changelog entries** for work already on `main`. > > **Client `@launchdarkly/cpp-client` 3.13.0** (depends on **internal 0.16.0**): documents **FDv2 data source orchestration**, **FDv2 cache initialization with per-context freshness**, and a fix so the **C bindings no longer swap custom event JSON and metric values** on metric track calls. > > **Server `@launchdarkly/cpp-server` 3.15.0** picks up the same **FDv2 orchestrator** and **C API track/metric fix** via **internal 0.16.0**. **Redis**, **DynamoDB**, and **OTel** server add-ons are re-released with only a dependency bump to server **3.15.0**. > > There is **no new application logic in this diff**—only release metadata and documentation of prior merges. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 8ff5cfd. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
kinyoklion
added a commit
to launchdarkly/lua-server-sdk
that referenced
this pull request
Nov 12, 2026
…correctly (#132) <!-- TERMAG_PR_BODY_BEGIN --> ## Summary With C++ server SDK versions before 3.15.0, `client:track(key, context, data, metric)` sends the metric value as the event data and the data as the metric value ([cpp-sdks#639](launchdarkly/cpp-sdks#639)). This raises the documented minimums to C++ server SDK 3.15.0 and Redis source 2.4.3, and moves the examples and CI to those versions. It also adds a test service for the [SDK test harness](https://github.com/launchdarkly/sdk-test-harness) in `contract-tests/`, and a CI job that runs it. The service is an OpenResty app that runs the SDK from the checkout. `test-suppressions.txt` lists the 313 tests that fail today, and the README groups them by cause: missing reason fields in the C API, `allFlags` without the flags state, empty `{}` and `[]` that Lua tables cannot tell apart, and JSON nulls lost inside objects. Tested locally with C++ server SDK 3.15.0: with the suppressions, 5228 tests pass on harness v2.43.0 and 4705 on v2.42.0, and the Lua unit tests pass. <!-- TERMAG_PR_BODY_END --> <!-- termag: box=i-01f1398ff5db110f3 project=lua-stuff --> <sub>Opened from termag</sub> <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > Raises the required **C++ server-side SDK** minimum to **3.15.0** and **Redis source** to **2.4.3** (CI env, README, and example Dockerfiles) so `client:track` with a metric value is correct on the fixed C++ binding instead of older releases that swapped data and metric. > > Adds a **`contract-tests/`** OpenResty service that implements the SDK test harness protocol, plus **`test-suppressions.txt`** for 313 currently failing cases (documented gaps such as reason fields, `allFlags` shape, Lua JSON `{}`/`[]`, and null handling). **CI** gains a **`contract-tests`** job that builds the service image and runs the shared contract-tests action with those suppressions. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit f7a042f. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
LDServerSDK_TrackMetricandLDClientSDK_TrackMetricpassed the metric value and the data toTrackin the wrong order. The implicit conversions betweenValueanddoublelet the call compile, so the event carried the metric value as its data, and the data converted to a number (usually 0) as its metric value. This affects every caller of these two C functions, including the Lua server-side SDK. The C++ API andLDServerSDK_TrackMetric_WithHookContextalready pass the values in the right order.Tested with new server and client C binding tests, which fail before this change and pass after it. The full server and client unit test suites pass.
Opened from termag
Note
Overview
LDClientSDK_TrackMetricandLDServerSDK_TrackMetricwere forwarding arguments to the underlyingTrackcall in the wrong order, so the numeric metric was stored as event data and theLDValuepayload was treated as the metric (often becoming0via implicit conversion). The C bindings now match the C++ API and the existingLDServerSDK_TrackMetric_WithHookContextpath: data first, thenmetric_value.Regression coverage adds a client test that subclasses
Clientto assert the received data and metric, and a server hook test that readsLDTrackSeriesContext_DataandLDTrackSeriesContext_MetricValueafterLDServerSDK_TrackMetric.Reviewed by Cursor Bugbot for commit f9f68b6. Bugbot is set up for automated code reviews on this repo. Configure here.